package org.nlp2rdf.navigator.benchmark.cli;

import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.ResourceFactory;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;
import org.nlp2rdf.navigator.benchmark.*;
import org.springframework.context.ApplicationContext;

import java.util.Set;

/**
 * Created by Claus Stadler
 * Date: Oct 23, 2010
 * Time: 12:22:35 PM
 */
public class RunGetTypedDBpediaCategoryMembers {
        private static Options cliOptions = new Options()
        .addOption("c", "configFile", true, "Spring XML config")
        .addOption("k", "categoryName", true, "category name to search for");

    public static void main(String[] args)
            throws Exception
    {
        CommandLine commandLine = CliUtils.getGnuCommandLine(cliOptions, args);
        ApplicationContext context = CliUtils.getApplicationContext(commandLine, commandLine.getOptionValue("c"));

        BenchmarkContext con = new BenchmarkContext(context);

        Resource category = ResourceFactory.createResource(commandLine.getOptionValue("k"));

        Set<Resource> resources = MySparqlTasks.getTypedDBpediaCategoryMembers(con.getSparqlEndpoint(), con.getGraphNames(), category);

        CliUtils.outputSet(resources);
    }
}
